package cn.song.freight.exception;

import lombok.Getter;

/**
 * <p>
 *   自定义异常
 * </p>
 * @author SongRenShuo
 */
@Getter
public class CustomException extends RuntimeException {
    /**
     * 错误码
     */
    private final Integer code;
    /**
     * 错误信息
     */
    private final String msg;

    /**
     * 自定义异常 错误码+错误信息
     *
     * @param code 错误码
     * @param msg 错误信息
     *
     */
    public CustomException(Integer code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    /**
     * 自定义异常 错误信息
     *
     * @param msg 错误信息
     */
    public CustomException(String msg) {
        super(msg);
        this.code = -1;
        this.msg = msg;
    }
}
